#!/usr/bin/env python
# -*- coding:utf-8 -*-

# file:多线程共享全局变量的问题.py
# author: 马国鑫
# datetime:2022/3/28 18:59
# software: PyCharm

"""
this is function  description 
"""

# import module your need

import threading
import time
g_num = 0


def sum_num1():
    global g_num
    for i in range(1000000):
        g_num += 1
    print('sum1:',g_num)



def sum_num2():
    global g_num
    for i in range(1000000):
        g_num += 1
    print('sum2:',g_num)


if __name__ == '__main__':
    sub_sum1 = threading.Thread(target=sum_num1)
    sub_sum2 = threading.Thread(target=sum_num2)

    sub_sum1.start()
    sub_sum2.start()

